libxc: osdep: convert xc_evtchn_unbind()
authorIan Campbell <ian.campbell@citrix.com>
Fri, 3 Dec 2010 09:36:47 +0000 (09:36 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 3 Dec 2010 09:36:47 +0000 (09:36 +0000)
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
tools/libxc/xc_evtchn.c
tools/libxc/xc_linux.c
tools/libxc/xc_minios.c
tools/libxc/xc_netbsd.c
tools/libxc/xc_solaris.c
tools/libxc/xenctrlosdep.h

index fadb00cca77504ff2f62cd09d560ba1ea983d00f..81fc15b29add9f51c12514b11cb2c12b1127d312 100644 (file)
@@ -107,6 +107,11 @@ xc_evtchn_bind_virq(xc_evtchn *xce, unsigned int virq)
     return xce->ops->u.evtchn.bind_virq(xce, xce->ops_handle, virq);
 }
 
+int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port)
+{
+    return xce->ops->u.evtchn.unbind(xce, xce->ops_handle, port);
+}
+
 /*
  * Local variables:
  * mode: C
index bc5cc279fc5b93b2c88ce9a1395719b41997dea9..9044020fe89ef8462de55902b37915cd1d59b488 100644 (file)
@@ -410,13 +410,14 @@ linux_evtchn_bind_virq(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq)
     return ioctl(fd, IOCTL_EVTCHN_BIND_VIRQ, &bind);
 }
 
-int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port)
+static int linux_evtchn_unbind(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t port)
 {
+    int fd = (int)h;
     struct ioctl_evtchn_unbind unbind;
 
     unbind.port = port;
 
-    return ioctl(xce->fd, IOCTL_EVTCHN_UNBIND, &unbind);
+    return ioctl(fd, IOCTL_EVTCHN_UNBIND, &unbind);
 }
 
 evtchn_port_or_error_t
@@ -445,6 +446,7 @@ static struct xc_osdep_ops linux_evtchn_ops = {
         .bind_unbound_port = &linux_evtchn_bind_unbound_port,
         .bind_interdomain = &linux_evtchn_bind_interdomain,
         .bind_virq = &linux_evtchn_bind_virq,
+        .unbind = &linux_evtchn_unbind,
     },
 };
 
index b9587a493ef154fd77760834c52068acc355e6ff..e01b4b499255987326328c7eefaef58b4282a4dc 100644 (file)
@@ -328,20 +328,21 @@ static evtchn_port_or_error_t minios_evtchn_bind_interdomain(xc_evtchn *xce, xc_
     return local_port;
 }
 
-int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port)
+static int minios_evtchn_unbind(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t port)
 {
+    int fd = (int)h;
     int i;
     for (i = 0; i < MAX_EVTCHN_PORTS; i++)
-       if (files[xce->fd].evtchn.ports[i].port == port) {
-           files[xce->fd].evtchn.ports[i].port = -1;
+       if (files[fd].evtchn.ports[i].port == port) {
+           files[fd].evtchn.ports[i].port = -1;
            break;
        }
     if (i == MAX_EVTCHN_PORTS) {
-       printf("Warning: couldn't find port %"PRId32" for xc handle %x\n", port, xce->fd);
+       printf("Warning: couldn't find port %"PRId32" for xc handle %x\n", port, fd);
        errno = -EINVAL;
        return -1;
     }
-    files[xce->fd].evtchn.ports[i].bound = 0;
+    files[fd].evtchn.ports[i].bound = 0;
     unbind_evtchn(port);
     return 0;
 }
@@ -410,6 +411,7 @@ static struct xc_osdep_ops minios_evtchn_ops = {
         .bind_unbound_port = &minios_evtchn_bind_unbound_port,
         .bind_interdomain = &minios_evtchn_bind_interdomain,
         .bind_virq = &minios_evtchn_bind_virq,
+        .unbind = &minios_evtchn_unbind,
     },
 };
 
index 85b4d5c3085d74b9d616d2605eabb3581ab8d44b..9d708fce57701a744636f3b368f26596d6bccb2c 100644 (file)
@@ -259,13 +259,14 @@ netbsd_evtchn_bind_interdomain(xc_evtchn *xce, xc_osdep_handle h, int domid,
        return -1;
 }
 
-int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port)
+static int netbsd_evtchn_unbind(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t port)
 {
+    int fd = (int)h;
     struct ioctl_evtchn_unbind unbind;
 
     unbind.port = port;
 
-    return ioctl(xce->fd, IOCTL_EVTCHN_UNBIND, &unbind);
+    return ioctl(fd, IOCTL_EVTCHN_UNBIND, &unbind);
 }
 
 static evtchn_port_or_error_t
@@ -310,6 +311,7 @@ static struct xc_osdep_ops netbsd_evtchn_ops = {
          .bind_unbound_port = &netbsd_evtchn_bind_unbound_port,
          .bind_interdomain = &netbsd_evtchn_bind_interdomain,
          .bind_virq = &netbsd_evtchn_bind_virq,
+         .unbind = &netbsd_evtchn_unbind,
     },
 };
 
index 2bdb985b0f83bd1cb7403c060f326b251ec59c9f..ea786e79eebb1afdf3992addb6c8854cb0b99f59 100644 (file)
@@ -252,13 +252,14 @@ solaris_evtchn_bind_virq(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq)
     return ioctl(fd, IOCTL_EVTCHN_BIND_VIRQ, &bind);
 }
 
-int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port)
+static int solaris_evtchn_unbind(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t port)
 {
+    int fd = (int)h;
     struct ioctl_evtchn_unbind unbind;
 
     unbind.port = port;
 
-    return ioctl(xce->fd, IOCTL_EVTCHN_UNBIND, &unbind);
+    return ioctl(fd, IOCTL_EVTCHN_UNBIND, &unbind);
 }
 
 evtchn_port_or_error_t
@@ -287,6 +288,7 @@ static struct xc_osdep_ops solaris_evtchn_ops = {
         .bind_unbound_port = &solaris_evtchn_bind_unbound_port,
         .bind_interdomain = &solaris_evtchn_bind_interdomain,
         .bind_virq = &solaris_evtchn_bind_virq,
+        .unbind = &solaris_evtchn_unbind,
     },
 };
 
index 1869ba2737bb2e92aa53938858c4ae0bd16c4d0c..9091d0be8fbb1ebe0de5c32c87ee3e67a98703f3 100644 (file)
@@ -83,6 +83,8 @@ struct xc_osdep_ops
             evtchn_port_or_error_t (*bind_interdomain)(xc_evtchn *xce, xc_osdep_handle h, int domid,
                                                        evtchn_port_t remote_port);
             evtchn_port_or_error_t (*bind_virq)(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq);
+
+            int (*unbind)(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t port);
         } evtchn;
     } u;
 };